package OurGame;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;

import javax.swing.ImageIcon;

public class Bullet {
	int x, y;// -- Controls the CURRENT location of THIS bullet
	// Each object of this class is a new BULLET
	Image img;
	boolean visible;
	String code1,code2;

	// sets weather THIS bullet is visible or not

	public int getX() {
		return x;
	}

	public boolean getVisible() {
		return visible;
	}

	public int getY() {
		return y;
	}

	public Image getImage() {
		return img;
	}

	public Rectangle getBounds() {
		return new Rectangle(x, y, 30, 30);
	}
	
	public String getCode1()
	{
		return code1;
	}
	
	public String getCode2()
	{
		return code2;
	}
	
	public Bullet(int startX, int startY, int ran) {
		ImageIcon newBullet;
		if (ran >= 60)
		{
			newBullet = new ImageIcon("Image/shit.png");
			img = newBullet.getImage();
			code2 = img.toString();
		}
		else
		{
			newBullet = new ImageIcon("Image/egg.png");
			img = newBullet.getImage();
			code1 = img.toString();
		}
		
		
		x = startX;
		y = startY;
		visible = true;
	}

	// Just like the move class in Dude class...
	public void move() {
		y = y + 1; // x + bullet speed
		if (y > (640 - 60))// if x > board width
			// Make the bullet invisible
			visible = false;
	}
}
